package services;

import domain.entities.MiembroBms;

public class CriteriaStaff extends Criteria{

    private MiembroBms staff;

    public CriteriaStaff(MiembroBms staff) {
        this.staff = staff;
    }

    @Override
    public boolean isIn(Object element){
        boolean isIn = true;

        MiembroBms other = (MiembroBms)element;

        isIn &= isSubstring(staff.getBmsId(),other.getBmsId());
        isIn &= isSubstring(staff.getName(),other.getName());
        isIn &= isSubstring(staff.getSurname(),other.getSurname());
        //isIn &= isSubstring(staff.getEmail(),other.getEmail());
        isIn &= staff.getRole() == null || staff.getRole().getId() == null || staff.getRole().getId().intValue() == other.getRole().getId().intValue();
        return isIn;
    }
}
